package rad.framework.uml2.classdiagram.providers;

import rad.framework.uml2.classdiagram.edit.parts.ActorEditPart;
import rad.framework.uml2.classdiagram.edit.parts.ActorNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.Association2EditPart;
import rad.framework.uml2.classdiagram.edit.parts.Association3EditPart;
import rad.framework.uml2.classdiagram.edit.parts.Association4EditPart;
import rad.framework.uml2.classdiagram.edit.parts.Association5EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationEditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName2EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName3EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName4EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName5EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName6EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName7EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName8EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName9EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.ClassEditPart;
import rad.framework.uml2.classdiagram.edit.parts.ClassNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.ClassPropertiesEditPart;
import rad.framework.uml2.classdiagram.edit.parts.DependencyEditPart;
import rad.framework.uml2.classdiagram.edit.parts.DependencyNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.EnumerationEditPart;
import rad.framework.uml2.classdiagram.edit.parts.EnumerationLiteralEditPart;
import rad.framework.uml2.classdiagram.edit.parts.EnumerationLiteralsEditPart;
import rad.framework.uml2.classdiagram.edit.parts.EnumerationNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.GeneralizationEditPart;
import rad.framework.uml2.classdiagram.edit.parts.InterfaceEditPart;
import rad.framework.uml2.classdiagram.edit.parts.InterfaceNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.InterfaceOperationsEditPart;
import rad.framework.uml2.classdiagram.edit.parts.OperationEditPart;
import rad.framework.uml2.classdiagram.edit.parts.PackageEditPart;
import rad.framework.uml2.classdiagram.edit.parts.PropertyEditPart;
import rad.framework.uml2.classdiagram.edit.parts.UseCaseEditPart;
import rad.framework.uml2.classdiagram.edit.parts.UseCaseNameEditPart;
import rad.framework.uml2.classdiagram.part.UMLVisualIDRegistry;
import rad.framework.uml2.classdiagram.view.factories.ActorNameViewFactory;
import rad.framework.uml2.classdiagram.view.factories.ActorViewFactory;
import rad.framework.uml2.classdiagram.view.factories.Association2ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.Association3ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.Association4ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.Association5ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName2ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName3ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName4ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName5ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName6ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName7ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName8ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationName9ViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationNameViewFactory;
import rad.framework.uml2.classdiagram.view.factories.AssociationViewFactory;
import rad.framework.uml2.classdiagram.view.factories.ClassNameViewFactory;
import rad.framework.uml2.classdiagram.view.factories.ClassPropertiesViewFactory;
import rad.framework.uml2.classdiagram.view.factories.ClassViewFactory;
import rad.framework.uml2.classdiagram.view.factories.DependencyNameViewFactory;
import rad.framework.uml2.classdiagram.view.factories.DependencyViewFactory;
import rad.framework.uml2.classdiagram.view.factories.EnumerationLiteralViewFactory;
import rad.framework.uml2.classdiagram.view.factories.EnumerationLiteralsViewFactory;
import rad.framework.uml2.classdiagram.view.factories.EnumerationNameViewFactory;
import rad.framework.uml2.classdiagram.view.factories.EnumerationViewFactory;
import rad.framework.uml2.classdiagram.view.factories.GeneralizationViewFactory;
import rad.framework.uml2.classdiagram.view.factories.InterfaceNameViewFactory;
import rad.framework.uml2.classdiagram.view.factories.InterfaceOperationsViewFactory;
import rad.framework.uml2.classdiagram.view.factories.InterfaceViewFactory;
import rad.framework.uml2.classdiagram.view.factories.OperationViewFactory;
import rad.framework.uml2.classdiagram.view.factories.PackageViewFactory;
import rad.framework.uml2.classdiagram.view.factories.PropertyViewFactory;
import rad.framework.uml2.classdiagram.view.factories.UseCaseNameViewFactory;
import rad.framework.uml2.classdiagram.view.factories.UseCaseViewFactory;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;

/**
 * @generated
 */
public class UMLViewProvider extends AbstractViewProvider {

	/**
	 * @generated
	 */
	protected Class getDiagramViewClass(IAdaptable semanticAdapter,
			String diagramKind) {
		EObject semanticElement = getSemanticElement(semanticAdapter);
		if (PackageEditPart.MODEL_ID.equals(diagramKind)
				&& UMLVisualIDRegistry.getDiagramVisualID(semanticElement) != -1) {
			return PackageViewFactory.class;
		}
		return null;
	}

	/**
	 * @generated
	 */
	protected Class getNodeViewClass(IAdaptable semanticAdapter,
			View containerView, String semanticHint) {
		if (containerView == null) {
			return null;
		}
		IElementType elementType = getSemanticElementType(semanticAdapter);
		if (elementType != null
				&& !UMLElementTypes.isKnownElementType(elementType)) {
			return null;
		}
		EClass semanticType = getSemanticEClass(semanticAdapter);
		EObject semanticElement = getSemanticElement(semanticAdapter);
		int nodeVID = UMLVisualIDRegistry.getNodeVisualID(containerView,
				semanticElement, semanticType, semanticHint);
		switch (nodeVID) {
		case ClassEditPart.VISUAL_ID:
			return ClassViewFactory.class;
		case ClassNameEditPart.VISUAL_ID:
			return ClassNameViewFactory.class;
		case EnumerationEditPart.VISUAL_ID:
			return EnumerationViewFactory.class;
		case EnumerationNameEditPart.VISUAL_ID:
			return EnumerationNameViewFactory.class;
		case InterfaceEditPart.VISUAL_ID:
			return InterfaceViewFactory.class;
		case InterfaceNameEditPart.VISUAL_ID:
			return InterfaceNameViewFactory.class;
		case ActorEditPart.VISUAL_ID:
			return ActorViewFactory.class;
		case ActorNameEditPart.VISUAL_ID:
			return ActorNameViewFactory.class;
		case UseCaseEditPart.VISUAL_ID:
			return UseCaseViewFactory.class;
		case UseCaseNameEditPart.VISUAL_ID:
			return UseCaseNameViewFactory.class;
		case PropertyEditPart.VISUAL_ID:
			return PropertyViewFactory.class;
		case EnumerationLiteralEditPart.VISUAL_ID:
			return EnumerationLiteralViewFactory.class;
		case OperationEditPart.VISUAL_ID:
			return OperationViewFactory.class;
		case ClassPropertiesEditPart.VISUAL_ID:
			return ClassPropertiesViewFactory.class;
		case EnumerationLiteralsEditPart.VISUAL_ID:
			return EnumerationLiteralsViewFactory.class;
		case InterfaceOperationsEditPart.VISUAL_ID:
			return InterfaceOperationsViewFactory.class;
		case AssociationNameEditPart.VISUAL_ID:
			return AssociationNameViewFactory.class;
		case AssociationName2EditPart.VISUAL_ID:
			return AssociationName2ViewFactory.class;
		case AssociationName3EditPart.VISUAL_ID:
			return AssociationName3ViewFactory.class;
		case AssociationName4EditPart.VISUAL_ID:
			return AssociationName4ViewFactory.class;
		case AssociationName5EditPart.VISUAL_ID:
			return AssociationName5ViewFactory.class;
		case AssociationName6EditPart.VISUAL_ID:
			return AssociationName6ViewFactory.class;
		case AssociationName7EditPart.VISUAL_ID:
			return AssociationName7ViewFactory.class;
		case AssociationName8EditPart.VISUAL_ID:
			return AssociationName8ViewFactory.class;
		case AssociationName9EditPart.VISUAL_ID:
			return AssociationName9ViewFactory.class;
		case DependencyNameEditPart.VISUAL_ID:
			return DependencyNameViewFactory.class;
		}
		return null;
	}

	/**
	 * @generated
	 */
	protected Class getEdgeViewClass(IAdaptable semanticAdapter,
			View containerView, String semanticHint) {
		IElementType elementType = getSemanticElementType(semanticAdapter);
		if (elementType != null
				&& !UMLElementTypes.isKnownElementType(elementType)) {
			return null;
		}
		EClass semanticType = getSemanticEClass(semanticAdapter);
		if (semanticType == null) {
			return null;
		}
		EObject semanticElement = getSemanticElement(semanticAdapter);
		int linkVID = UMLVisualIDRegistry.getLinkWithClassVisualID(
				semanticElement, semanticType);
		switch (linkVID) {
		case GeneralizationEditPart.VISUAL_ID:
			return GeneralizationViewFactory.class;
		case AssociationEditPart.VISUAL_ID:
			return AssociationViewFactory.class;
		case Association2EditPart.VISUAL_ID:
			return Association2ViewFactory.class;
		case Association3EditPart.VISUAL_ID:
			return Association3ViewFactory.class;
		case Association4EditPart.VISUAL_ID:
			return Association4ViewFactory.class;
		case Association5EditPart.VISUAL_ID:
			return Association5ViewFactory.class;
		case DependencyEditPart.VISUAL_ID:
			return DependencyViewFactory.class;
		}
		return getUnrecognizedConnectorViewClass(semanticAdapter,
				containerView, semanticHint);
	}

	/**
	 * @generated
	 */
	private IElementType getSemanticElementType(IAdaptable semanticAdapter) {
		if (semanticAdapter == null) {
			return null;
		}
		return (IElementType) semanticAdapter.getAdapter(IElementType.class);
	}

	/**
	 * @generated
	 */
	private Class getUnrecognizedConnectorViewClass(IAdaptable semanticAdapter,
			View containerView, String semanticHint) {
		// Handle unrecognized child node classes here
		return null;
	}

}
